package com.chushouya.controller.manager.api;

import com.chushouya.common.annotations.AuthValidate;
import com.chushouya.common.constant.ServiceType;
import com.chushouya.common.support.Contexts;
import com.chushouya.manager.dto.api.suggest.FeedbackDTO;
import com.chushouya.manager.service.api.SuggestApiService;
import com.general.framework.core.schema.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 反馈建议接口控制器
 * 提供用户反馈相关功能
 * 
 * @author chushouya
 */
@Api(tags = ServiceType.API + "反馈建议接口")
@RestController
@RequestMapping(ServiceType.API + "/suggest")
public class SuggestApiController {

    @Resource
    private SuggestApiService suggestApiService;

    @AuthValidate
    @ApiOperation("提交用户反馈")
    @PostMapping("/feedback")
    public Response<Long> feedback(@RequestBody @Validated FeedbackDTO feedbackDTO) {
        Long suggestId = suggestApiService.submitFeedback(feedbackDTO);
        return Response.success(suggestId);
    }
}
